#!/bin/bash

install_java() {
    if ! command -v java > /dev/null 2>&1; then
        echo "Java未安装，正在尝试安装..."
        if command -v pkg > /dev/null 2>&1; then
            echo "检测到支持的包管理器，正在安装Java..."
            sed -i 's@^\(deb.*stable main\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/apt/termux-main stable main@' $PREFIX/etc/apt/sources.list
            apt update && apt upgrade
            pkg i openjdk-17 -y
        else
            echo "请安装java"
            exit 1
        fi
    fi
}
install_java
download_netease_mc_decrypter() {
    if [ ! -f NeteaseMcDencrypter.jar ]; then
        echo "下载相关程序..."
        curl -s -Lo NeteaseMcDencrypter.jar "https://lz.qaiu.top/parser?url=https://wwvg.lanzoub.com/iJvlt2e24r5a&pwd=2994"
    fi
}
download_netease_mc_decrypter
echo "输入存档路径/db"
java -jar NeteaseMcDencrypter.jar
